daemonize yes
pidfile {{ redis_pidfile }}
bind 0.0.0.0
port {{ redis_port | default('6379')}}
tcp-backlog 511
timeout {{ redis_timeout }}
tcp-keepalive 0
maxclients 20000
loglevel {{ redis_loglevel }}
logfile "{{ redis_logfile }}"
databases {{ redis_databases }}
stop-writes-on-bgsave-error yes
rdbcompression {{ redis_rdbcompression }}
rdbchecksum yes
dbfilename {{ redis_dbfilename }}
dir {{ redis_dbdir }}
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
repl-backlog-size 100mb
slave-priority 100
{% if redis_requirepass %}
requirepass {{ redis_requirepass }}
{% endif %}
{% if redis_cluster and redis_requirepass %}
masterauth {{ redis_requirepass }}
{% endif %}

{% if redis_slave %}
slaveof {{ redis_master_host }} {{ redis_master_port }}
{% endif %}

{% if redis_cluster %}
cluster-enabled yes
cluster-config-file {{ redis_dir_path }}/nodes.conf
cluster-node-timeout 10000
cluster-migration-barrier 1
cluster-require-full-coverage no
{% endif %}

{% if redis_masterauth %}
masterauth {{ redis_masterauth }}
{% endif %}

maxmemory {{ redis_maxmemory }}
maxmemory-policy allkeys-lru 
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
{% if redis_rename_command %}

rename-command KEYS     "LEKEYS"
rename-command CONFIG   "LECONFIG"
rename-command FLUSHALL "LEFLUSHALL"
rename-command FLUSHDB  "LEFLUSHDB"
{% endif %}